﻿@{
    @model IEnumerable<Epilog.Core.Model.BlogPost>
    ViewBag.Title = "Index";
}

<h2>Index</h2>

@if(User.IsInRole("BlogAuthor")) {
    <p>
        @Html.ActionLink("Create New", "Edit")
    </p>
}
<table>
    <tr>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostUrl)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostTitle)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostCreated)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostPublished)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostEdited)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostDraftBody)
        </th>
        <th>
            @Html.DisplayNameFor(model => model.BlogPostPublishedBody)
        </th>
        <th></th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostUrl)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostTitle)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostCreated)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostPublished)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostEdited)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostDraftBody)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.BlogPostPublishedBody)
        </td>
        <td>
            @Html.ActionLink("Edit", "Edit", new { id=item.BlogPostId })
            @*@if(User.IsInRole("BlogAuthor")) {
            {
            <text>
                | @Html.ActionLink("View", "View", new { id=item.BlogPostId })
                | @Html.ActionLink("Delete", "Delete", new { id=item.BlogPostId })
            </text>
            }
        *@</td>
    </tr>
}

</table>
